<template>
  <!-- 消息详情 -->
  <div class="details">
    <van-nav-bar
      title="消息详情"
      left-arrow
      @click-left="backClick"
    ></van-nav-bar>
    <div class="content">
      <van-cell
        center
        :title="msgtype == 1 ? '系统通知' : '个人通知'"
        :value="createTime"
        :label="'发布人：' + sourceName"
      >
      </van-cell>
      <div class="content-text">
        <p>{{ msgDate }}</p>
      </div>
    </div>
  </div>
</template>

<script>
import { GetmessageDetailsData } from "@/request/api";
export default {
  data() {
    return {
      id: this.$route.query.id,
      msgtype: 1,
      createTime: "",
      sourceName: "",
      msgDate: "",
    };
  },
  methods: {
    backClick() {
      this.$router.go(-1);
    },
  },
  created() {
    console.log(this.id);
    GetmessageDetailsData(this.id).then((res) => {
      console.log(res);
      this.msgtype = res.data.type;
      this.createTime = res.data.createTime;
      this.sourceName = res.data.sourceName;
      this.msgDate = res.data.msgDate;
    });
  },
};
</script>
 
<style lang = "less" scoped>
.details {
  width: 100%;
  min-height: 100%;
  background-color: pink;
  z-index: 99;
}
.van-nav-bar {
  background-color: rgb(6, 6, 139);
  /deep/.van-nav-bar__title,
  /deep/.van-icon,
  /deep/.van-nav-bar__text {
    color: #fff;
  }
}
.content {
  margin-top: 10px;
}
/deep/.van-cell {
  border: 0;
}
.content-text {
  background-color: #fff;
  p {
    margin-top: 0;
    padding: 0 16px;
    color: rgb(131, 131, 131);
  }
}
</style>